package com.afalon.cloud.contracts.competition;

import java.net.URI;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@PersistenceCapable
@XmlRootElement(name = "tournament")
@XmlAccessorType(XmlAccessType.NONE)
public class Tournament {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key tournamentKey;
	
	@XmlElement
	@Persistent
	private String name;
	
	@XmlElement(name="tournamenturi")
	public URI tournamentUri;
	
	public Tournament() 
	{
		
	}

	public Key getTournamentKey() {
		return tournamentKey;
	}
	
	@XmlElement(name="tournamentid")
	public String getTournamentId() {
		return KeyFactory.keyToString(this.getTournamentKey());
	}
		
	public void setName(String value) {
		name = value;
	}

	public String getName() {
		return name;
	}
	
}
